package pers.amos.eshop.advance.data.sync.mq.support;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pers.amos.eshop.advance.data.sync.common.RabbitQueueConstants;
import pers.amos.eshop.advance.data.sync.mq.AbstractQueueReceiver;
import pers.amos.eshop.advance.data.sync.mq.RabbitMqSender;

/**
 * @author amos wong
 * @create 2020-12-16 8:59 上午
 */
@RabbitListener(queues = RabbitQueueConstants.DATA_CHANGE_QUEUE)
@Component
public class DataChangeQueueReceiver extends AbstractQueueReceiver {

    @Autowired
    private RabbitMqSender mqSender;

    @Override
    @RabbitHandler
    public void process(String message) {
        super.process(message);
    }

    @Override
    protected void sendMessage(String message) {
        mqSender.send(RabbitQueueConstants.AGGREGATION_DATA_CHANGE_QUEUE, message);
    }
}
